﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class GiaoDienClient_TrangThayDoiTK : System.Web.UI.Page
{
    SoLienLacDataContext db = new SoLienLacDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string mahs = Session["Username"].ToString();
            var c = from p in db.HocSinhs
                    where p.MaHS == mahs
                    select new { p.HoTenCha, p.MatKhau };
            lblMaHS.Text = mahs;
            //txtMKCu.Text = c.First().MatKhau;
            txtTenPH.Text = c.First().HoTenCha;
        }
    }
    protected void btnDongY_Click(object sender, EventArgs e)
    {
        var c = from p in db.HocSinhs
                where p.MaHS == Session["Username"].ToString()
                select new { p.HoTenCha, p.MatKhau };
        if (txtTenPH.Text != "" && txtMKCu.Text != "" && txtMKMoi.Text != "" && txtMKMoi2.Text != "")
        {
            if (txtMKCu.Text == c.First().MatKhau.ToString())
            {
                if (txtMKMoi2.Text == txtMKMoi.Text)
                {
                    db.procCapNhatMatKhau2(lblMaHS.Text, txtMKMoi.Text, txtTenPH.Text, txtEmail.Text, txtSDT.Text);
                }
            }
        }
    }
}